//
//  LOLRuneTableViewCell.m
//  LOLXXbox
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLRuneTableViewCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@implementation LOLRuneTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViews];
    
        self.nameLabel = [[UILabel alloc] init];
        self.nameLabel.font = [UIFont systemFontOfSize:20];
        [self.contentView addSubview:self.nameLabel];
        
        self.priceLabel = [[UILabel alloc] init];
        self.priceLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.priceLabel];
        
        self.levLabel = [[UILabel alloc] init];
        self.levLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.levLabel];

    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViews mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.contentView).offset(10);
        make.bottom.equalTo(self.contentView).offset(-10);
        make.width.equalTo(@130);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.imageViews.mas_right).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@40);
    }];
    
    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.nameLabel.mas_bottom).offset(10);
        make.left.equalTo(self.imageViews.mas_right).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@30);
    }];
    
    [self.levLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.priceLabel.mas_bottom).offset(10);
        make.left.equalTo(self.imageViews.mas_right).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@30);
    }];
}

- (void)setRuneModel:(LOLRuneModel *)runeModel{
    _runeModel = runeModel;
    self.nameLabel.text = self.runeModel.name;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
